<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head> 
  <meta charset="utf-8" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
  <meta name="description" content="" /> 
  <meta name="author" content="" /> 
  <!--<meta http-equiv="refresh" content="60">-->
  <!--[if IE]>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <![endif]--> 
  <title>首页</title> 
  <!-- BOOTSTRAP CORE STYLE  --> 
  <link href="__STATIC__/index/css/bootstrap.css" rel="stylesheet" /> 
  <!-- FONT AWESOME STYLE  --> 
  <link href="__STATIC__/index/css/font-awesome.css" rel="stylesheet" /> 
  <!-- CUSTOM STYLE  --> 
  <link href="__STATIC__/index/css/style.css" rel="stylesheet" />
  <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/normalize.css" />
  <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/default.css">
 <script src="__STATIC__/index/js/Chart.js"></script>
 <style>
    .buy{
        padding:0.4em 0.6em;margin-left:15px;
        float:left;
    }
    .nav-tabs li a{padding:0;font-size: 14px;}
    .tab-content {
        height:270px;
        overflow: auto;
    }
    .table-bordered tbody tr td {
        padding:0 ;
        font-size: 14px;
    }
    .table{margin-bottom:0;}
    .panel-body{
        padding-top:5px;
    }
    .menu-section{
        border-bottom:1px solid #9170E4;
    }
    .footer-section{
        padding:5px 50px;
        border-top: 1px solid #9170E4;
    }
    #open-hao{
        width:20px; 
        height:20px;
        border-radius:5px;
        float:left;
        margin-right:5px;
    }
    #zhang{
        border:none;
        color:#FFF;
        box-shadow: 2px 2px 1px #888888;
        margin-left: 25px;
    }
    #die{
        border:none;
        color:#FFF;
        box-shadow: 2px 2px 1px #888888;
    }

    /*兼容6*/
    @media (max-width:375px){
        #open-hao{
            width:19px; 
            height:19px;
        }
    }

    /*兼容*/
    @media (max-width:360px){
        #open-hao{
            width:18px; 
            height:18px;
            /*margin-right:3px;*/
        }
        #zhang{
            margin-left: 8px;
        }
    }
    
    /*兼容5S*/
    @media (max-width:320px){
        #open-hao{
            width:18px; 
            height:18px;
            margin-right:2px;
        }
        #zhang{
            margin-left: 8px;
        }
    }
  
    </style>
 </head> 
 <body> 
     <script src="__STATIC__/index/js/jquery-1.10.2.js"></script> 
<style>
.navbar-toggle .icon-bar{
    width:15px;
}
#menu-top{
    background: #f7f7f7;
    padding:5px;
    padding-left:10px;
    display: none;
}
#menu-top li{
    margin-bottom:5px;
    
}
#menu-top li a{
    padding:2px 0;
    text-align: left;
}

#game-title{
    font-size: 16px;
}
#login{
    padding:4px 7px;
}
#register{
    margin-left:5px;
    padding:4px 7px;
}
.login-left{
    float:right;
    padding: 3px 10px 0 0;
    height:30px;
}
.money{
    margin-left:4px;
    color:green;
    padding-top:7px;
    word-break:break-all;
    word-wrap:break-word;
    padding-left:0px;
    padding-right:0px;
    font-size:14px;
    margin-left:16%;
    padding-bottom:0;
    height:20px;
}

.yonghu{
    float: left;
    font-size: 18px;
    line-height: 20px;
    color:#777;
    word-break:break-all;
    word-wrap:break-word;
    margin-left:15%;
    padding-top:7px;
    font-size:14px;
}

/*兼容6*/
@media (max-width:375px){
    #game-title{
        font-size: 15px;
    }

    #login{
        padding:2px 5px;
    }
    #register{
        margin-left:3px;
        padding:2px 5px;
    }
    .login-left{
        padding: 5px 10px 0 0;
    }
    .money{
        margin-left:10%;
    }
}

/*兼容5S*/
@media (max-width:320px){
    #game-title{
        font-size: 15px;
    }

    #login{
        padding:2px 5px;
    }
    #register{
        margin-left:3px;
        padding:2px 5px;
    }
    .login-left{
        padding: 5px 8px 0 0;
    }
    .money{
        margin-left:5%;
    }
    .yonghu{
        margin-left:5%;
    }
}
.ball1{
    background-color: #FEFA0A;
}
.ball2{
    background-color: #008DFF;
}
.ball3{
    background-color: #4D4A4D;
}
.ball4{
    background-color: #FE7700;
}
.ball5{
    background-color: #8CFBFD;
}
.ball6{
    background-color: #3E0DED;
}
.ball7{
    background-color: #E2E5E2;
}
.ball8{
    background-color: #FA0700;
}
.ball9{
    background-color: #750002;
}
.ball10{
    background-color: #21CE06;
}
@media (min-width:768px){
    .navbar-toggle{
        display:block;
    }
}
</style>
<div class="navbar navbar-inverse set-radius-zero" style="min-height:35px;height:37px;">
    <div class="container" style="height:35px;">
        <div class="navbar-header"  style="height:35px;">
            <a class="navbar-brand" style="padding:0" href="{:url('index/index/index')}">
                <img src="__STATIC__/index/logo.jpg" style="width:30px;height:30px;position:absolute;margin:0px 0px;top:3px;left:4px;" />
            </a>
            <span id="game-title" style="float: left;margin-left: 40px;margin-top:5px;font-size: 13px;">冠军投资&nbsp;<a href="{:url('index/index/index')}" style="font-size: 13px;">首页</a>&nbsp;
            </span>    
            <span style="color: red;font-size: 13px;line-height: 32px;">
                {if condition="session('uid') eq null"} 
                    <span><a href="{:url('index/login/index')}" class="btn btn-info" id="login" >登录</a></span>
                    <span><a href="{:url('index/register/index')}" class="btn btn-info" id="register" >注册</a></span>
                {else/}
                       <span style="color:#404d5b;line-height: 40px;"> 用户名 : {:session('username')}</span>&nbsp;
                       <span style="color:#404d5b;line-height: 40px;" id="moneys"> 积分 : {$money['money']}</span>
                {/if}
                <span id="uid" style="display: none">{:session('uid')}</span>
                </span>           
        </div>

        <!-- <div class="right-div">
            <a href="#" class="btn btn-danger pull-right">LOG ME OUT</a>
        </div> -->
    </div>
</div>
<!-- LOGO HEADER END-->


 <script>

var width = $(window).width();

//var ipone5 = 320;
//var ipone6 = 375;
//var ipone6P = 414;
//if(width<=ipone6 && width>ipone5){
    //$(".money").css({marginLeft:'15%'});
//}
//if(width<=ipone6P && width>ipone6){
    //$(".money").css({marginLeft:'20%'});
//}


$('.navbar-toggle').click(function(){
    if($('#menu-top').css('display')=='none'){
        $('#menu-top').show();
    }else{
        $('#menu-top').hide();
    }
    
});

 </script>
 
  <div class="content-wrapper" style="margin-top:0;padding:0;min-height: 500px;"> 
   <div class="container"> 

<!-- 开盘区 -->
  <table class="table table-striped table-bordered table-hover dataTable no-footer"  aria-describedby="dataTables-example_info"  style="padding:3px 0;"> 
           <tbody>
            <tr class="gradeC odd"> 
                 <td class="sorting_1" width="27%" style="text-align:center; vertical-align:middle;height:31px;">
                    {empty name="new"}  
                    {else /}    
                    {$new.qishu}期
                    {/empty}
                 </td> 
                 <td class="sorting_2" style="vertical-align:middle; padding-left:3px" >
                    &nbsp;
                     {foreach name='new2' item='v'}
                    <div id="open-hao" class="ball{$v}">
                         <span style="height:20px; line-height:20px; display:block; color:#FFF; text-align:center;">{$v}</span>
                            </div>
                    
                    {/foreach}

                                        
                 </td> 
            </tr>
        <tr>
     <td  style="text-align:center;height:30px;line-height:30px;" class="sorting_3"><span id="nexts">{$next_qishu}</span>期</td>
         <td style="  vertical-align:middle;" id="jishi">
            封盘 <span style="border:1px solid #b18b8b;padding:0 4px;" class="fengpan"><span id="fp_m">00分</span><span id="fp_s">00秒</span></span>  
            开奖 <span style="border:1px solid #b18b8b;padding:0 4px;" class="kaijiang"><span id="kj_m">00分</span><span id="kj_s">00秒</span></span> 
         </td>              
       <!--  <td  style="text-align:center;height:30px;line-height:30px;" class="sorting_3"><span id="nexts">{$next_qishu}</span>期</td>
         <td style="  vertical-align:middle;" id="jishi">
            封盘 <span style="border:1px solid #b18b8b;padding:0 4px;" class="fengpan"><span id="fp_m">00分</span><span id="fp_s">00秒</span></span>  
            开奖 <span style="border:1px solid #b18b8b;padding:0 4px;" class="kaijiang"><span id="kj_m">00分</span><span id="kj_s">00秒</span></span> 
         </td>       -->
      </tr>
            
            
               
           </tbody> 
          </table>

<!-- 开盘区 -->

    <div class="row"> 
     <div class="col-md-12" style="padding:0;"> 
      <!-- Advanced Tables -->
        
      <!--End Advanced Tables --> 
     </div>
    <div class="col-md-6 col-sm-6" style="padding:0;margin-bottom: 53px;">
        <div class="panel panel-default">
            <div class="panel-body">
                <ul class="nav nav-tabs">
                    <li class="active" style="width:33.3%;text-align: center;"><a href="#home" data-toggle="tab" id="homeUrl">开奖结果</a>
                    </li>
                    <!-- <li style="width: 33.3%;text-align: center;"><a href="#orderBy" data-toggle="tab">龙虎榜</a> -->
                    <!-- </li> -->
                    <li class="" style="width: 33.3%;text-align: center;"><a href="#profile" data-toggle="tab" id="canvasImg">位置走势图</a>
                    </li>
                </ul>

              <div class="tab-content" style="padding-bottom: 60px;">
                    <div class="tab-pane fade active in" id="home">
                        <!--    Context Classes  -->
                        <div class="panel panel-default">
                                <div class="table-responsive">
                                    <table class="table table-bordered" style="text-align:center;">
                                        <tbody>
                                        {volist name="data" id="vo"}    
                                        <tr class="success">
                                                <td style="width:33%;">{$vo.qishu}</td>
                                                <td style="width:33%;">
                                                    {switch $vo.ball1}
                                                    {case 1}<div style="width:18px; height:18px; background-color:#FEFA0A; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 2}<div style="width:18px; height:18px; background-color:#008DFF; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 3}<div style="width:18px; height:18px; background-color:#4D4A4D; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 4}<div style="width:18px; height:18px; background-color:#FE7700; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 5}<div style="width:18px; height:18px; background-color:#8CFBFD; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 6}<div style="width:18px; height:18px; background-color:#3E0DED; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 7}<div style="width:18px; height:18px; background-color:#E2E5E2; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 8}<div style="width:18px; height:18px; background-color:#FA0700; border-radius:5px;margin:0 auto;">{/case}
                                                    {case 9}<div style="width:18px; height:18px; background-color:#750002; border-radius:5px;margin:0 auto;">{/case}
                                                    {default/}<div style="width:18px; height:18px; background-color:#21CE06; border-radius:5px;margin:0 auto;">
                                                    {/switch}
                                                     <span style="height:18px; line-height:18px; display:block; color:#FFF; text-align:center">{$vo.ball1}</span>
                                                    </div> 
                                                </td>
                                                <td style="width:33%;">
                                                    {switch $vo.status}
                                                    {case 0}<span style="color:#13c813;">{/case}
                                                    {case 1}<span style="color:#f42a25;">{/case}
                                                    {/switch}
                                                    {$vo.page}</span></td>
                                        </tr>
                                        {/volist}  
        </tbody>
                                    </table>
                                </div>
                        </div>
                        <!--  end  Context Classes  -->
                    </div>
                    <div class="tab-pane fade" id="orderBy">
                        <!--    Context Classes  -->
                        <div class="panel panel-default">
                                <div class="table-responsive">
                                    <table class="table table-bordered" style="text-align:center;word-break:break-all;word-wrap:break-word;">
                                        <tr>
                                            <td width="33.3%">排名</td>
                                            <td width="33.3%">用户</td>
                                            <td width="33.3%">收益</td>
                                        </tr>
                                        <tbody>
                                            {volist name="win" id="vo"}
                                            <tr class="">
                                                <td>{$key+1}</td>
                                                <td><?php 
                                                    echo  substr_replace($vo['username'],'****',1,-1); 
                                                    ?><!-- {$vo.username} --></td>          
                                                <td>{$vo.winmoneys}</td>
                                            </tr>
                                            {/volist}                                      
                                         </tbody>
                                    </table>
                                </div>
                        </div>
                        <!--  end  Context Classes  -->
                    </div>
                    <div class="tab-pane fade " id="profile" style="overflow-x:scroll;">
                        <canvas id="myChart" height="250" width="500"></canvas>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div> 
   </div> 
  </div> 
  <!-- CONTENT-WRAPPER SECTION END--> 
   <section class="footer-section" style="position:fixed;bottom:0;width:100%;padding-bottom: 40px;padding-top: 40px;"> 
    <div style="margin: auto;width: 120%;">
        <input class="form-control" type="number"  name="money" style="width:135px;float:left;font-size:12px;margin-left: -40px;" placeholder="赔率：1:{$set}" id="money">
        <button href="#" class="btn btn-danger buy"  value="1" data-type="1" id="zhang" style="background-color: red">买涨</button>
        <button href="#" class="btn btn-success buy"  value="0" data-type="2" id="die" style="background-color: green;left:15px;">买跌</button>
        {if condition="session('uid') eq null"} 
        {else /}
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" style="margin:2px 10px 0 0;height:30px;padding:0px 8px;float: left;margin-left:10px;">
        <span class="icon-bar" style="background-color: white;"></span>
        <span class="icon-bar" style="background-color: white;"></span>
        <span class="icon-bar" style="background-color: white;"></span>
        </button>
        {/if}
    
    </div>

  </section> 
        <ul id="menu-top" class="nav navbar-nav navbar-right"  style=" z-index:100;width:80px; left:0;background:#F7F7F7;display: none;float: left;position: fixed;bottom:0;font-size: 13px;margin-bottom: 72px;border:1px solid #E3E3E5;margin-left: 235px;">
                                <li><a href="{:url('index/index/index')}">首页</a></li>
                                <li><a href="{:url('index/order/index')}">投资记录</a></li>
                                <li><a href="javasrript:void(0)">今日收益<br/>
                                 {empty name="today"}
                                （0.00）  
                                 {else /}   
                                （{$today}）
                                 {/empty}
                                </a></li>
                                {if condition="$money.vip gt 1"}
                                 <li><a href="{:url('index/returns/index')}">退水结果</a></li>
                                {else/}
                                {/if}       
                                <li><a href="{:url('index/index/rule')}">投资规则</a></li>
                                <li><a href="{:url('index/login/loginout')}">退出登录</a></li>
</ul>
  <!-- FOOTER SECTION END--> 
  <!-- JAVASCRIPT FILES PLACED AT THE BOTTOM TO REDUCE THE LOADING TIME  --> 
  <!-- CORE JQUERY  --> 
  <script src="__STATIC__/index/js/jquery-1.10.2.js"></script> 
  <!-- BOOTSTRAP SCRIPTS  --> 
  <script src="__STATIC__/index/js/bootstrap.js"></script> 
  <script src="__STATIC__/index/layer.js"></script>
  <div style="display:none" id="conFirm">
    <form id="orderForm">
        <input type="hidden" name="nper" value="678022">
        <input type='hidden' value='' name='buy_type'>
        <input type='hidden' value='' name='buy_money'>
        <div style="paddin-left:0;">金额：<span id="confirmMoney"></span></div>
        <div style="paddin-left:0;">方式：<span id="confirmType"></span></div>
    </form>
  </div>
 </body>
</html>
<script>
$.get("{:url('index/index/index2')}",function(msg){
   var ctx = document.getElementById('myChart').getContext('2d');
   var chart = new Chart(ctx, {
    // 要创建的图表类型
    type: 'line',

    // 数据集
    data: {
        labels: [msg[0]['qishu']+'期', msg[1]['qishu']+'期', msg[2]['qishu']+'期', msg[3]['qishu']+'期',msg[4]['qishu']+'期', msg[5]['qishu']+'期', msg[6]['qishu']+'期',msg[7]['qishu']+'期',msg[8]['qishu']+'期',msg[9]['qishu']+'期'],
        datasets: [{
            label: "位置走势图",
            backgroundColor: 'rgba(151, 187, 205,0.3)',
            borderColor: 'rgb(151, 187, 205)',
            data: [msg[0]['ball1'], msg[1]['ball1'], msg[2]['ball1'], msg[3]['ball1'], msg[4]['ball1'], msg[5]['ball1'], msg[6]['ball1'], msg[7]['ball1'], msg[8]['ball1'], msg[9]['ball1']],
        }]
    },
    // 配置项
    options: {}
    });
});

/*$(".buy").on("click",function  () {
    var is_login="0";
    if(is_login=='0'){
        return layer.open({
           content: '还没登录'
            ,btn: ['去登录','算了']
            ,yes: function(index){
              layer.close(index);
              location.href="/lottery/index.php/home/login/index.html";
            }
        });
    }
    var money=$("[name='money']").val();
    var _this=$(this);
    var type= _this.data('type');
    if(type==1){
        $("#confirmType").html("买涨");
    }else{
        $("#confirmType").html("买跌");
    }
    if(!/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/.test(money)){
        $("[name='money']")[0].focus();
        return  layer.open({
            content: '金额错误'
            ,skin: 'msg'
            ,time: 2 //2秒后自动关闭
        });
        return false;
    }
    if(parseFloat(money)>50000){
        return  layer.open({
            content: '单笔最高投资金额50000元'
            ,skin: 'msg'
            ,time: 2 //2秒后自动关闭
          });
    }
    if(parseFloat(money)<10){
        return  layer.open({
            content: '单笔最低投资金额10元'
            ,skin: 'msg'
            ,time: 2 //2秒后自动关闭
          });
    }
    if(parseFloat(money)>parseFloat($(".myMoney").html())){
        return  layer.open({
            content: '金额不足'
            ,skin: 'msg'
            ,time: 2 //2秒后自动关闭
          });
    }

    $("#confirmMoney").html(money);
    $("[name='buy_type']").val(type);
    $("[name='buy_money']").val(money);
      //询问框
    layer.open({
        content:$("#conFirm").html()
        ,btn: ['买入', '取消']
        ,yes: function(index){
          layer.close(index);
          $.ajax({
            url:"/lottery/index.php/home/index/add_order.html",
            data:$("#orderForm").serialize(),
            type:"post",
            success:function  (data) {
                if(data.status){
                    layer.open({
                       content: data.msg
                        ,btn: '我知道了'
                        ,yes: function(index){
                          window.location.reload();
                          layer.close(index);
                        }
                     });
                }else if(data.timeOut){
                    layer.open({
                       content: data.msg
                        ,btn: '我知道了'
                        ,yes: function(index){
                          window.location.reload();
                          layer.close(index);
                        }
                     });
                }else{
                    layer.open({
                        content: data.msg
                        ,skin: 'msg'
                        ,time: 2 //2秒后自动关闭
                      });
                }
            }
          })
        }
    });
})
*/
$("#zhang").click(function(){
    var uid = $("#uid").text();
    var nexts = $("#nexts").text();
    var money = $("#money").val();
    var updown = $("#zhang").val();
    if(uid == ""){
         alert('你还没进行登录');
         location.href="{:url('index/login/index')}";
    }else{
    if(money < 1){
        alert("单笔最低投资金额1元");
        return false;
    };
    if(parseFloat(money)>50000){
        alert("单笔最高投资金额50000元");
        return false;
    };
    }
    $.post('{:url('index/orders/index')}',{qishu:nexts,money:money,updown:updown},function(data) { 
            console.log(data);
              if(data== 200){
                alert('下注成功');
                location.href="{:url('index/index/index')}";
              }else if(data == 101){
                alert("账户余额不足");
              }else if(data == 102){
                alert("下注失败");
              }else{
                alert("请求失败");
            }            
      }); 
});
$("#die").click(function(){
    var uid = $("#uid").text();
    var nexts = $("#nexts").text();
    var money = $("#money").val();
    var updown = $("#die").val();
    if(uid == ""){
         alert('你还没进行登录');
         location.href="{:url('index/login/index')}";
    }else{
    if( money < 1){
        alert("单笔最低投资金额1积分");
        return false;
    };
    if(parseFloat(money)>50000){
        alert("单笔最高投资金额50000积分");
        return false;
    };
    }
    $.post('{:url('index/orders/index')}',{qishu:nexts,money:money,updown:updown},function(data) {
        console.log(data);
              if(data== 200){
                alert('下注成功');
                location.href="{:url('index/index/index')}";
              }else if(data == 101){
                alert("账户余额不足");
              }else if(data == 102){
                alert("下注失败");
              }else{
                alert("请求失败");
            }                   
      }); 
});
/*var time = "1524446301";
var NowTime = new Date();
var test = NowTime.getTime();
test = Math.floor(test/1000);
var cha = time-test;
//封盘倒计时
function GetRTime(){
    var NowTime = new Date();

    var fp_time = "2018-04-23 09:20:50";
    //console.log(fp_time);
    
    var EndTime= new Date(fp_time);
    
    var t =EndTime.getTime() - (NowTime.getTime()+cha*1000);
    
    //console.log(EndTime.getTime() NowTime.getTime());
    var m=0;
    var s=0;
    var h=0;
    if(t>=0){
     
      h=Math.floor(t/1000/3600);
      m=Math.floor(t/1000/60%60);
      s=Math.floor(t/1000%60);
    }
    //console.log(h);
    if(h<=0){
        document.getElementById("fp_m").innerHTML = m + "分"
        document.getElementById("fp_s").innerHTML = s + "秒";
        if(m==0 && s==0 && h==0){
            clearInterval(window.fengpan);
            $('#zhang').attr('disabled','disabled');
            $('#die').attr('disabled','disabled');
        }
    }else{
        $(".fengpan").html('尚未开启');
        
    }
    
}
var fengpan = setInterval(GetRTime,0);


//开奖倒计时
function GetRTime1(){

    var fp_time = "2018/04/23 09:22:50";
    //var EndTime= new Date('2017-05-23 21:02:00');
    var EndTime= new Date(fp_time);
    var NowTime = new Date();

    var t =EndTime.getTime() - (NowTime.getTime()+cha*1000);
    var m=0;
    var s=0;
    var h=0;
    if(t>=0){
      h=Math.floor(t/1000/3600);
      m=Math.floor(t/1000/60%60);
      s=Math.floor(t/1000%60);
    }
    
    if(h<=0){
        document.getElementById("kj_m").innerHTML = m + "分";
        document.getElementById("kj_s").innerHTML = s + "秒";
        if(m==0 && s==0 && h==0){
            
            clearInterval(window.kaijiang);
            $('#zhang').attr('disabled','disabled');
            $('#die').attr('disabled','disabled');
            layer.open({
                content: '已开奖!'
                ,btn: '我知道了'
                ,yes: function(index){
                  clearInterval(window.kaijiang);
                  clearInterval(window.fengpan);
                  layer.close(index);
                  window.location.reload();
                  
                }
             });
            
        }
    }else{
        
        $(".kaijiang").html('尚未开启');
        
        
    }
    
}
var kaijiang = setInterval(GetRTime1,0);*/

/*var time = "1524446301";*/
var time = "{$kaij_times}";
document.write(time);
var NowTime = new Date();
var test = NowTime.getTime();
test = Math.floor(test/1000);
var cha = time-test;
//封盘倒计时
function GetRTime(){
    var NowTime = new Date();

  /* var fp_time = "2018/04/23 09:20:50";*/
    var fp_time = "{$feng_time}";
   /* document.write(fp_time);*/
    //console.log(fp_time);
    var EndTime= new Date(fp_time);
    
    var t =EndTime.getTime() - (NowTime.getTime());
    /*var t =EndTime.getTime() - (NowTime.getTime()+cha*1000);*/
    
    //console.log(EndTime.getTime() NowTime.getTime());
    var m=0;
    var s=0;
    var h=0;
    if(t>=0){
     
      h=Math.floor(t/1000/3600);
      m=Math.floor(t/1000/60%60);
      s=Math.floor(t/1000%60);
    }
    //console.log(h);
    if(h<=0){
        document.getElementById("fp_m").innerHTML = m + "分"
        document.getElementById("fp_s").innerHTML = s + "秒";
        if(m==0 && s==0 && h==0){
            clearInterval(window.fengpan);
            $('#zhang').css({'background-color':'#ccc'});
            $('#die').css({'background-color':'#ccc'});
            $('#zhang').attr('disabled','disabled');
            $('#die').attr('disabled','disabled');
        }
    }else{
        $(".fengpan").html('尚未开启');
        
    }
    
}
var fengpan = setInterval(GetRTime,0);


//开奖倒计时
function GetRTime1(){

    /*var fp_time = "2018/04/23 09:22:50";*/
    var fp_time = "{$kaij_time}";
    var EndTime= new Date(fp_time);
    var NowTime = new Date();

    var t =EndTime.getTime() - (NowTime.getTime());
    /*var t =EndTime.getTime() - (NowTime.getTime()+cha*1000);*/
    var m=0;
    var s=0;
    var h=0;
    if(t>=0){
      h=Math.floor(t/1000/3600);
      m=Math.floor(t/1000/60%60);
      s=Math.floor(t/1000%60);
    }
    
    if(h<=0){
        document.getElementById("kj_m").innerHTML = m + "分";
        document.getElementById("kj_s").innerHTML = s + "秒";
        if(m==0 && s==0 && h==0){
            
            clearInterval(window.kaijiang);
            clearInterval(window.fengpan);
            $('#zhang').css({'background-color':'#ccc'});
            $('#die').css({'background-color':'#ccc'});
            $('#zhang').attr('disabled','disabled');
            $('#die').attr('disabled','disabled');
            $.post('{:url('index/index/datas')}',function(data) {
            });
            $.post('{:url('index/orders/win')}',function(msg) {
                clearInterval(window.kaijiang);
                clearInterval(window.fengpan);
               $("#moneys").load("{:url('index/index/index')}");

            }); 
             window.location.reload();
            
        }
    }else{
        
        $(".kaijiang").html('尚未开启');
        
        
    }
    
}
var kaijiang = setInterval(GetRTime1,0);




//开码兼容
var ma_div = $('.sorting_2').width();
if(ma_div<=204){
    $('.sorting_2').children('div').css({width:"15px",height:"15px",fontSize:'12px',lineHeight:'15px'});
    $('.sorting_2').children('div').children('span').css({lineHeight:'15px',width:'15px'});
    
}
if(ma_div<=245){
    $('.sorting_2').children('div').css({width:"18px",height:"18px",fontSize:'13px',lineHeight:'18px'});
    $('.sorting_2').children('div').children('span').css({lineHeight:'18px',width:'18px'});
    
}

var jishi =  $('#jishi').width();
if(jishi<=231){
    $('#jishi').css({fontSize:"14px"});
}

var sorting_1 = $('.sorting_1').width();
if(sorting_1<=68){
    $('.sorting_1').css({fontSize:"14px"});
    $('.sorting_3').css({fontSize:"14px"});
    
    
}


//数据显示
var tab_content  = $('.tab-content').width();
var ipone6 = 343;
var ipone6P = 382;
var ipone5= 288;

if(tab_content<=ipone5){
    $('.tab-content').height('360px');
    $('#die').css({marginLeft:'20px'});
    $('.buy').css({padding:'0.3em 0.5em'});
}
if(tab_content<=ipone6 && tab_content>ipone5 ){
    $('.tab-content').height('460px');
}
if(tab_content<=ipone6P && tab_content>ipone6 ){
    $('.tab-content').height('528px');
}

 $(function(){
    //两秒刷新一次开奖
      setInterval(function () { 
        $("#dataTables-example").load(location.href+" #dataTables-example"); 
      }, 2000);
  })

</script>